package com.kgc.student.studentuserweb.controller;

import com.kgc.student.bean.Student;
import com.kgc.student.service.StudentService;
import com.kgc.student.studentuserweb.util.ResultEntity;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author shkstart
 * @create 2020-10-06 21:03
 */
@RestController
public class StudentController {

    @Reference
    StudentService studentService;

    @RequestMapping("/select")
    public List<Student> select(){
        List<Student> students = studentService.selectStudent();
        return  students;
    }

    @RequestMapping("/add")
    public ResultEntity<Integer> add(@RequestBody Student student){
        Integer integer = studentService.addStudent(student);
        return ResultEntity.successWithoutData(integer);
    }
}
